(function() {
    fetch('http://chst.vip:1234/api/getinlanddiscount').then(body => body.json()).then(res => {
        let result = res.result;
        console.log(result);
        let proStr = ''
        result.forEach(item => {
            proStr += `
            <li date-index="${item.productId}">
                <a href="#">
                    <div class="img">
                    ${item.productImg}
                    </div>
                    <div class="centent">
                        <h3>${item.productName}</h3>
                        <div class="price">¥ ${item.productPrice}</div>
                        <span>${item.productFrom} | ${item.productTime}</span>
                    </div>
                </a>
            </li>
            `
        });
        $('.product').html(proStr);
    });
    $('.product').on('click', 'li', function() {
        let curIndex = $(this).attr('date-index');
        // console.log(location);
        location.href = location.host + '../html/inlandproduct.html?productid=' + curIndex
    })
})()